<?php
function gettree($parent,$root){
	if($parent->count() > 0){
		if(!$root){
		echo "<div id='".$parent->getname()."'>";}
		$root=false;
		foreach( $parent->children() AS $child ){
			gettree($child,false);
			}
		echo "</div>";
		}
	else{
		echo "<div id='".$parent."'>";
		include( 'modules/'.$parent.'/index.php');
		echo "</div>";
		}
	}

?>
<!DOCTYPE html>
<html >

<head>
	<title><?php echo $vars->site->sitename; ?></title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<meta name="generator" content="Geany 0.20" />
	<link rel="stylesheet" href=<?php echo 'themes/'.$vars->site->theme.'/screen.css';?>>
</head>

<body>
<?php

gettree($xml->elements,true);
?>

</body>

</html>
